package com.example.demo.order;

import com.example.demo.repo.Repo;
import com.example.demo.repo.model.Order;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    // 获取所有订单
    @GetMapping
    public List<Order> getOrders() {
        return repo.getAllOrders();
    }

    private Repo repo;

    public OrderController(Repo repo) {
        this.repo = repo;
    }
}
